PROJECT(DICOMParser)

INCLUDE_DIRECTORIES(${DICOMParser_SOURCE_DIR})
INCLUDE_DIRECTORIES(${DICOMParser_BINARY_DIR})

IF(WIN32)
  IF(BUILD_SHARED_LIBS)
    SET(DICOM_DLL 1)
  ELSE(BUILD_SHARED_LIBS)
    SET(DICOM_STATIC 1)
  ENDIF(BUILD_SHARED_LIBS)
ENDIF(WIN32)

IF(VTK_SOURCE_DIR)
   # Inside VTK, use its setting.
   SET(DICOM_ANSI_STDLIB ${VTK_USE_ANSI_STDLIB})
ELSE(VTK_SOURCE_DIR)
   # Not inside VTK, use ANSI streams.
   SET(DICOM_ANSI_STDLIB 1)
ENDIF(VTK_SOURCE_DIR)

INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
SET(DICOM_NO_STD_NAMESPACE ${CMAKE_NO_STD_NAMESPACE})


CONFIGURE_FILE(${DICOMParser_SOURCE_DIR}/DICOMCMakeConfig.h.in
               ${DICOMParser_BINARY_DIR}/DICOMCMakeConfig.h)

VTK_ADD_LIBRARY(vtkDICOMParser DICOMFile.cxx DICOMParser.cxx DICOMAppHelper.cxx)

# Apply user-defined properties to the library target.
IF(VTK_LIBRARY_PROPERTIES)
  SET_TARGET_PROPERTIES(vtkDICOMParser PROPERTIES ${VTK_LIBRARY_PROPERTIES})
ENDIF(VTK_LIBRARY_PROPERTIES)

IF(NOT VTK_INSTALL_NO_LIBRARIES)
  INSTALL(TARGETS vtkDICOMParser
    EXPORT ${VTK_INSTALL_EXPORT_NAME}
    RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries
    LIBRARY DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries
    ARCHIVE DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT Development)
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
  FILE(GLOB __install_files.h "${DICOMParser_SOURCE_DIR}/*.h")
  FILE(GLOB __install_files.txx "${DICOMParser_SOURCE_DIR}/*.h")
  INSTALL(FILES
    ${__install_files.h} ${__install_files.txx}
    ${DICOMParser_BINARY_DIR}/DICOMCMakeConfig.h
    DESTINATION "${VTK_INSTALL_INCLUDE_DIR_CM24}"
    COMPONENT Development)
ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
